/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/**
 * @brief  分区号与单元ID的映射关系服务接口
 * @author wuxingchuang
 * @date   2025.07.24
 */
#pragma once

#include "DBManager/Common/Trait/InputTrait.h"
#include "DBManager/DBServiceFactory.h"
#include "DBManager/IRepository/Base/SummaryDefine.h"

SG_DBMANAGER_NAMESPACE_OPEN

/**
 * @brief    分区结果的Service接口，提供分区号与单元ID映射关系的操作
 * @author   wuxingchuang
 * @date     2025.07.24
 */
class DBManager_DECLSPEC IPartitionElementCacheService : public AddTrait<SG::DBManager::TwoLayersData>,
                                                         public FindByIndexTrait<SG::DBManager::TwoLayersData>,
                                                         public FindByIdTrait<SG::DBManager::TwoLayersData>,
                                                         public GetAllDataTrait<SG::DBManager::TwoLayersData>,
                                                         public SizeTrait,
                                                         public GetAllIdTrait,
                                                         public CountTrait
{
  public:
    virtual ~IPartitionElementCacheService () = default;

    /**
     * @brief    根据分区ID获取该分区中的所有单元ID
     * @param    partitionId 分区ID
     * @return   该分区中的单元ID列表
     * @author   wuxingchuang
     * @date     2025.07.24
     */
    virtual std::vector<SG::DataStructure::Common::Id> GetElementsByPartition (SG::DataStructure::Common::Id partitionId) = 0;
};

template <>
std::shared_ptr<IPartitionElementCacheService> DBManager_DECLSPEC DBServiceFactory::get ();

SG_DBMANAGER_NAMESPACE_CLOSE
